package com.handsome.策略模式;

/**
 * @author niechun
 * @date 2023/3/27 19:59
 */
public abstract class Duck {
    private FlyBehavior flyBehavior;

    public abstract void display();

    public void fly(){
        if (flyBehavior!=null){
            flyBehavior.fly();
        }
    }

    public FlyBehavior getFlyBehavior() {
        return flyBehavior;
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }
}
